home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / Dev / Oberon / source / amiga / GadTools.mod < prev    next >
Text File  |  1995-06-29  |  24KB  |  686 lines

  1. (***************************************************************************
  2.  
  3.      $RCSfile: GadTools.mod $
  4.   Description: Interface to gadtools.library
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.8 $
  8.       $Author: fjc $
  9.         $Date: 1995/06/04 23:13:14 $
  10.  
  11.   Includes Release 40.15
  12.  
  13.   (C) Copyright 1989-1993 Commodore-Amiga, Inc.
  14.       All Rights Reserved
  15.  
  16.   Oberon-A interface Copyright © 1994-1995, Frank Copeland.
  17.   This file is part of the Oberon-A Interface.
  18.   See Oberon-A.doc for conditions of use and distribution.
  19.  
  20. ***************************************************************************)
  21.  
  22. <* STANDARD- *>
  23.  
  24. MODULE [2] GadTools;
  25.  
  26. IMPORT
  27.   SYS := SYSTEM, Kernel, e := Exec, u := Utility, gfx := Graphics,
  28.   i := Intuition, s := Sets;
  29.  
  30.  
  31. (*
  32. **      $VER: gadtools.h 39.9 (19.8.92)
  33. **
  34. **      gadtools.library definitions
  35. *)
  36.  
  37. (* -----------------------------------------------------------------------*)
  38.  
  39. (*  The kinds (almost classes) of gadgets in the toolkit.  Use these
  40.     identifiers when calling CreateGadgetA() *)
  41.  
  42. CONST
  43.  
  44.   genericKind *    = 0;
  45.   buttonKind *     = 1;
  46.   checkBoxKind *   = 2;
  47.   integerKind *    = 3;
  48.   listViewKind *   = 4;
  49.   mxKind *         = 5;
  50.   numberKind *     = 6;
  51.   cycleKind *      = 7;
  52.   paletteKind *    = 8;
  53.   scrollerKind *   = 9;
  54. (* Kind number 10 is reserved *)
  55.   sliderKind *     = 11;
  56.   stringKind *     = 12;
  57.   textKind *       = 13;
  58.  
  59.   numKinds *       = 14;
  60.  
  61. (* -----------------------------------------------------------------------*)
  62.  
  63. CONST
  64.  
  65. (*  'Or' the appropriate set together for your Window IDCMPFlags: *)
  66.  
  67.   arrowIDCMP *      = { i.gadgetUp, i.gadgetDown, i.intuiTicks,
  68.                         i.mouseButtons };
  69.  
  70.   buttonIDCMP *     = { i.gadgetUp };
  71.   checkBoxIDCMP *   = { i.gadgetUp };
  72.   integerIDCMP *    = { i.gadgetUp };
  73.   listViewIDCMP *   = { i.gadgetUp, i.gadgetDown, i.mouseMove }
  74.                       + arrowIDCMP;
  75.  
  76.   mxIDCMP *         = { i.gadgetDown };
  77.   numberIDCMP *     = {};
  78.   cycleIDCMP *      = { i.gadgetUp };
  79.   paletteIDCMP *    = { i.gadgetUp };
  80.  
  81. (*  Use ArrowIDCMP + ScrollerIDCMP if your scrollers have arrows: *)
  82.   scrollerIDCMP *   = { i.gadgetUp, i.gadgetDown, i.mouseMove };
  83.   sliderIDCMP *     = { i.gadgetUp, i.gadgetDown, i.mouseMove };
  84.   stringIDCMP *     = { i.gadgetUp };
  85.  
  86.   textIDCMP *       = {};
  87.  
  88. (* -----------------------------------------------------------------------*)
  89.  
  90. TYPE
  91.  
  92.   VisualInfo * = POINTER TO RECORD END;
  93.  
  94. (*  Generic NewGadget used by several of the gadget classes: *)
  95.  
  96.   NewGadgetPtr * = POINTER TO NewGadget;
  97.   NewGadget * = RECORD
  98.     leftEdge *,
  99.     topEdge *    : INTEGER;         (*  gadget position *)
  100.     width *,
  101.     height *     : INTEGER;         (*  gadget size *)
  102.     gadgetText * : e.LSTRPTR;       (*  gadget label *)
  103.     textAttr *   : gfx.TextAttrPtr; (*  desired font for gadget label *)
  104.     gadgetID *   : e.UWORD;         (*  gadget ID *)
  105.     flags *      : s.SET32;         (*  see below *)
  106.     visualInfo * : VisualInfo;      (*  Set to retval of GetVisualInfo() *)
  107.     userData *   : e.APTR;          (*  gadget UserData *)
  108.   END; (* NewGadget *)
  109.  
  110.  
  111. CONST
  112.  
  113. (* flags control certain aspects of the gadget.  The first five control
  114.  * the placement of the descriptive text.  Each gadget kind has its default,
  115.  * which is usually placeTextLeft.  Consult the autodocs for details.
  116.  *)
  117.  
  118.   placeTextLeft *  = 0;  (* Right-align text on left side *)
  119.   placeTextRight * = 1;  (* Left-align text on right side *)
  120.   placeTextAbove * = 2;  (* Center text above *)
  121.   placeTextBelow * = 3;  (* Center text below *)
  122.   placeTextIn *    = 4;  (* Center text on *)
  123.  
  124.   highLabel *      = 5;  (* Highlight the label *)
  125.  
  126. (* -----------------------------------------------------------------------*)
  127.  
  128. TYPE
  129.  
  130. (* Fill out an array of these and pass that to CreateMenus(): *)
  131.  
  132.   NewMenuPtr * = POINTER TO NewMenu;
  133.   NewMenu * = RECORD
  134.     type *          : SHORTINT; (*  See below *)
  135.     (* Compiler inserts a PAD byte here *)
  136.     label *         : e.LSTRPTR; (*  Menu's label *)
  137.     commKey *       : e.LSTRPTR; (*  MenuItem Command Key Equiv *)
  138.     flags *         : s.SET16;  (*  Menu or MenuItem flags (see note) *)
  139.     mutualExclude * : s.SET32;  (*  MenuItem MutualExclude word *)
  140.     userData *      : e.APTR;   (*  For your own use, see note *)
  141.   END; (* NewMenu *)
  142.  
  143. CONST
  144.  
  145. (* Needed only by inside im* definitions below *)
  146.   menuImage * = -128;
  147.  
  148. (* type determines what each NewMenu structure corresponds to.
  149.  * for the nmTitle, nmItem, and nmSub values, label should
  150.  * be a text string to use for that menu title, item, or sub-item.
  151.  * For imItem or imSub, set label to point at the Image structure
  152.  * you wish to use for this item or sub-item.
  153.  * NOTE: At present, you may only use conventional images.
  154.  * Custom images created from Intuition image-classes do not work.
  155.  *)
  156.   title *        = 1;
  157.   item *         = 2;
  158.   sub *          = 3;
  159.  
  160.   imItem *         = item + menuImage;
  161.   imSub *          = sub  + menuImage;
  162.  
  163. (* The NewMenu array should be terminated with a NewMenu whose
  164.  * type equals nmEnd.
  165.  *)
  166.   end * = 0;                  (* End of NewMenu array *)
  167.  
  168. (* Starting with V39, GadTools will skip any NewMenu entries whose
  169.  * ype field has the nmIgnore bit set.
  170.  *)
  171.   ignore * = 64;
  172.  
  173.  
  174. (* nm_Label should be a text string for textual items, a pointer
  175.  * to an Image structure for graphical menu items, or the special
  176.  * constant nmBarlabel, to get a separator bar.
  177.  *)
  178.   barLabel *     = SYS.VAL(e.LSTRPTR, -1);
  179.  
  180.  
  181. (*  The nmFlags field is used to fill out either the Menu.flags or
  182.     MenuItem.flags field.  Note that the sense of the menuEnabled or
  183.     itemEnabled bit is inverted between this use and Intuition's use,
  184.     in other words, NewMenus are enabled by default.  The following
  185.     labels are provided to disable them: *)
  186.   menuDisabled * = i.menuEnabled;
  187.   itemDisabled * = i.itemEnabled;
  188.  
  189. (* New for V39:  nmCommandString.  For a textual MenuItem or SubItem,
  190.  * point commKey at an arbitrary string, and set the nmCommandString
  191.  * flag.
  192.  *)
  193.   commandString * = i.commSeq;
  194.  
  195. (* The following are pre-cleared (commSeq, itemText, and highxxx are set
  196.  * later as appropriate):
  197.  * Under V39, the commSeq flag bit is not cleared, since it now has
  198.  * meaning.
  199.  *)
  200.   flagMask *     = -({i.commSeq, i.itemText} + i.highFlags);
  201.   flagMaskV39 *  = -({i.itemText} + i.highFlags);
  202.  
  203.  
  204. (*  You may choose among checkIt, menuToggle, and checked.
  205.     Toggle-select menuitems are of type checkIt | menuToggle, along
  206.     with checked if currently selected.  Mutually exclusive ones
  207.     are of type checkIt, and possibly checked too.  The nmMutualExclude
  208.     is a bit-wise representation of the items excluded by this one,
  209.     so in the simplest case (choose 1 among n), these flags would be
  210.     ~1, ~2, ~4, ~8, ~16, etc.  See the Intuition Menus chapter. *)
  211.  
  212. (* A UserData pointer can be associated with each Menu and MenuItem structure.
  213.  * The CreateMenus() call allocates space for a UserData after each
  214.  * Menu or MenuItem (header, item or sub-item).  You should use the
  215.  * GTMENU_USERDATA() or GTMENUITEM_USERDATA() macro to extract it.
  216.  *)
  217.  
  218. (*
  219. #define GTMENU_USERDATA(menu) ( * ( (APTR * )(((struct Menu * )menu)+1) ) )
  220. #define GTMENUITEM_USERDATA(menuitem) ( * ( (APTR * )(((struct MenuItem * )menuitem)+1) ) )
  221.  
  222. (* Here is an old one for compatibility.  Do not use in new code! *)
  223. #define MENU_USERDATA(menuitem) ( * ( (APTR * )(menuitem+1) ) )
  224. *)
  225.  
  226. (*  These return codes can be obtained through the gtmnSecondaryError tag *)
  227.   gtMenuTrimmed *  = 00000001H;      (* Too many menus, items, or subitems,
  228.                                            menu has been trimmed down *)
  229.   gtMenuInvalid *  = 00000002H;      (* Invalid NewMenu array *)
  230.   gtMenuNoMem *    = 00000003H;      (* Out of memory *)
  231.  
  232. (*------------------------------------------------------------------------*)
  233.  
  234. (* Starting with V39, checkboxes and mx gadgets can be scaled to your
  235.  * specified gadget width/height.  Use the new cbScaled or mxScaled
  236.  * tags, respectively.  Under V37, and by default in V39, the imagery
  237.  * is of the following fixed size:
  238.  *)
  239.  
  240. CONST
  241.  
  242. (* MX gadget default dimensions: *)
  243.   mxWidth * = 17;
  244.   mxHeight * = 9;
  245.  
  246. (* Checkbox default dimensions: *)
  247.   checkboxWidth * = 26;
  248.   checkboxHeight * = 11;
  249.  
  250. (* -----------------------------------------------------------------------*)
  251.  
  252. CONST
  253.  
  254. (* Tags for GadTools functions: *)
  255.  
  256.   tagBase *           = u.user + 80000H;
  257.  
  258.   viNewWindow *       = tagBase+1;  (* Unused *)
  259.   viNWTags *          = tagBase+2;  (* Unused *)
  260.  
  261.   Private0            = tagBase+3;  (* (private) *)
  262.  
  263.   cbChecked *         = tagBase+4;  (* State of checkbox *)
  264.  
  265.   lvTop *             = tagBase+5;  (* Top visible one in listview *)
  266.   lvLabels *          = tagBase+6;  (* List to display in listview *)
  267.  
  268.   noList * = SYS.VAL(e.ListPtr,-1); (* for short list locking (see RKMs) *)
  269.  
  270.   lvReadOnly *        = tagBase+7;  (* TRUE if listview is to be
  271.                                      * read-only
  272.                                      *)
  273.   lvScrollWidth *     = tagBase+8;  (* Width of scrollbar *)
  274.  
  275.   mxLabels *          = tagBase+9;  (* NULL-terminated array of labels *)
  276.   mxActive *          = tagBase+10; (* Active one in mx gadget *)
  277.  
  278.   txText *            = tagBase+11; (* Text to display *)
  279.   txCopyText *        = tagBase+12; (* Copy text label instead of
  280.                                      * referencing it
  281.                                      *)
  282.  
  283.   nmNumber *          = tagBase+13; (* Number to display *)
  284.  
  285.   cyLabels *          = tagBase+14; (* NULL-terminated array of labels *)
  286.   cyActive *          = tagBase+15; (* The active one in the cycle gad *)
  287.  
  288.   paDepth *           = tagBase+16; (* Number of bitplanes in palette *)
  289.   paColor *           = tagBase+17; (* Palette color *)
  290.   paColorOffset *     = tagBase+18; (* First color to use in palette *)
  291.   paIndicatorWidth *  = tagBase+19; (* Width of current-color indicator *)
  292.   paIndicatorHeight * = tagBase+20; (* Height of current-color indicator *)
  293.  
  294.   scTop *             = tagBase+21; (* Top visible in scroller *)
  295.   scTotal *           = tagBase+22; (* Total in scroller area *)
  296.   scVisible *         = tagBase+23; (* Number visible in scroller *)
  297.   scOverlap *         = tagBase+24; (* Unused *)
  298.  
  299. (*  tagBase+25 through tagBase+37 are reserved *)
  300.  
  301.   slMin *             = tagBase+38; (* Slider min value *)
  302.   slMax *             = tagBase+39; (* Slider max value *)
  303.   slLevel *           = tagBase+40; (* Slider level *)
  304.   slMaxLevelLen *     = tagBase+41; (* Max length of printed level *)
  305.   slLevelFormat *     = tagBase+42; (* Format string for level *)
  306.   slLevelPlace *      = tagBase+43; (* Where level should be placed *)
  307.   slDispFunc *        = tagBase+44; (* Callback for number calculation
  308.                                      * before display
  309.                                      *)
  310.  
  311.   stString *          = tagBase+45; (* String gadget's displayed string *)
  312.   stMaxChars *        = tagBase+46; (* Max length of string *)
  313.  
  314.   inNumber *          = tagBase+47; (* Number in integer gadget *)
  315.   inMaxChars *        = tagBase+48; (* Max number of digits *)
  316.  
  317.   mnTextAttr *        = tagBase+49; (* MenuItem font TextAttr *)
  318.   mnFrontPen *        = tagBase+50; (* MenuItem text pen color *)
  319.  
  320.   bbRecessed *        = tagBase+51; (* Make BevelBox recessed *)
  321.  
  322.   visualInfo *        = tagBase+52; (* result of VisualInfo call *)
  323.  
  324.   lvShowSelected *    = tagBase+53; (* show selected entry beneath
  325.                 * listview, set tag data = NULL for display-only, or pointer
  326.                 * to a string gadget you've created
  327.                 *)
  328.   lvSelected *        = tagBase+54; (* Set ordinal number of selected
  329.                                      * entry in the list
  330.                                      *)
  331.   Reserved1           = tagBase+56; (* Reserved for future use *)
  332.  
  333.   txBorder *          = tagBase+57; (* Put a border around
  334.                                      * Text-display gadgets
  335.                                      *)
  336.   nmBorder *          = tagBase+58; (* Put a border around
  337.                                      * Number-display gadgets
  338.                                      *)
  339.  
  340.   scArrows *          = tagBase+59; (* Specify size of arrows for
  341.                                      * scroller
  342.                                      *)
  343.  
  344.   mnMenu *            = tagBase+60; (* Pointer to Menu for use by
  345.                                      * LayoutMenuItems()
  346.                                      *)
  347.   mxSpacing *         = tagBase+61; (* Added to font height to
  348.                 * figure spacing between mx choices.  Use this instead
  349.                 * of layoutaSpacing for mx gadgets.
  350.                 *)
  351.  
  352. (* New to V37 GadTools.  Ignored by GadTools V36 *)
  353.   fullMenu *        = tagBase+62; (* Asks CreateMenus() to
  354.                 * validate that this is a complete menu structure
  355.                 *)
  356.   secondaryError *  = tagBase+63; (* tiData is a pointer
  357.                 * to a ULONG to receive error reports from CreateMenus()
  358.                 *)
  359.   underscore *        = tagBase+64; (* tiData points to the symbol
  360.                 * that preceeds the character you'd like to underline in a
  361.                 * gadget label
  362.                 *)
  363.   stEditHook *        = tagBase+55; (* String EditHook *)
  364.   inEditHook * = stEditHook;           (* Same thing, different name,
  365.                 * just to round out integerKind gadgets
  366.                 *)
  367.  
  368. (* New to V39 GadTools.  Ignored by GadTools V36 and V37 *)
  369.   mnCheckmark *    = tagBase+65;  (* data is checkmark img to use *)
  370.   mnAmigaKey *     = tagBase+66;  (* data is Amiga-key img to use *)
  371.   mnNewLookMenus * = tagBase+67;  (* data is boolean *)
  372.  
  373. (* New to V39 GadTools.  Ignored by GadTools V36 and V37.
  374.  * Set to TRUE if you want the checkbox or mx image scaled to
  375.  * the gadget width/height you specify.  Defaults to FALSE,
  376.  * for compatibility.
  377.  *)
  378.   cbScaled *        = tagBase+68;  (* data is boolean *)
  379.   mxScaled *        = tagBase+69;  (* data is boolean *)
  380.  
  381.   paNumColors *     = tagBase+70;  (* Number of colors in palette *)
  382.  
  383.   mxTitlePlace *    = tagBase+71;  (* Where to put the title *)
  384.  
  385.   txFrontPen *      = tagBase+72;  (* Text color in textKind gad *)
  386.   txBackPen *       = tagBase+73;  (* Bgrnd color in textKind gad *)
  387.   txJustification * = tagBase+74;  (* See j#? constants *)
  388.  
  389.   nmFrontPen *      = tagBase+72;  (* Text color in numberKind gad *)
  390.   nmBackPen *       = tagBase+73;  (* Bgrnd color in numberKind gad *)
  391.   nmJustification * = tagBase+74;  (* See j#? constants *)
  392.   nmFormat *        = tagBase+75;  (* Formatting string for number *)
  393.   nmMaxNumberLen *  = tagBase+76;  (* Maximum length of number *)
  394.  
  395.   bbFrameType *     = tagBase+77;  (* defines what kind of boxes
  396.                                     * DrawBevelBox() renders. See
  397.                                     * the bbft#? constants for
  398.                                     * possible values
  399.                                     *)
  400.  
  401.   lvMakeVisible *   = tagBase+78;  (* Make this item visible *)
  402.   lvItemHeight *    = tagBase+79;  (* Height of an individual item *)
  403.  
  404.   slMaxPixelLen *   = tagBase+80;  (* Max pixel size of level display *)
  405.   slJustification * = tagBase+81;  (* how should the level be displayed *)
  406.  
  407.   paColorTable *    = tagBase+82;  (* colors to use in palette *)
  408.  
  409.   lvCallBack *      = tagBase+83;  (* general-purpose listview call back *)
  410.   lvMaxPen *        = tagBase+84;  (* maximum pen number used by call back *)
  411.  
  412.   txClipped *       = tagBase+85;  (* make a textKind clip text *)
  413.   nmClipped *       = tagBase+85;  (* make a numberKind clip text *)
  414.  
  415. (* Old definition, now obsolete: *)
  416.   Reserved0 *       = stEditHook;
  417.  
  418. (*------------------------------------------------------------------------*)
  419.  
  420. (* Justification types for txJustification and nmJustification tags *)
  421.   jLeft * = 0;
  422.   jRight * = 1;
  423.   jCenter * = 2;
  424.  
  425. (*------------------------------------------------------------------------*)
  426.  
  427. (* Bevel box frame types for bbFrameType tag *)
  428.   bbftButton * = 1;         (* Standard button gadget box *)
  429.   bbftRidge * = 2;          (* Standard string gadget box *)
  430.   bbftIconDropBox * = 3;    (* Standard icon drop box     *)
  431.  
  432. (* -----------------------------------------------------------------------*)
  433.  
  434. CONST
  435.  
  436. (*  Typical suggested spacing between "elements": *)
  437.   interWidth *      = 8;
  438.   interHeight *     = 4;
  439.  
  440. (* -----------------------------------------------------------------------*)
  441.  
  442. CONST
  443.  
  444. (*  "NWay" is an old synonym for cycle gadgets *)
  445.   nWAYKind *     = cycleKind;
  446.   nWAYIDCMP *    = cycleIDCMP;
  447.   nwLabels *     = cyLabels;
  448.   nwActive *     = cyActive;
  449.  
  450.  
  451. (*------------------------------------------------------------------------*)
  452.  
  453. (* These two definitions are obsolete, but are here for backwards
  454.  * compatibility.  You never need to worry about these:
  455.  *)
  456.   gadToolBit * = 15;
  457. (* Use this mask to isolate the user part: *)
  458.   gadToolMask * = -{gadToolBit};
  459.  
  460. (*------------------------------------------------------------------------*)
  461.  
  462. (* These definitions are for the LV_CallBack tag *)
  463.  
  464. (* The different types of messages that a listview callback hook can see *)
  465.   lvDraw * = 0202H;            (* draw yourself, with state *)
  466.  
  467. (* Possible return values from a callback hook *)
  468.   lvcbOk * = 0;                 (* callback understands this message type    *)
  469.   lvcbUnknown * = 1;            (* callback does not understand this message *)
  470.  
  471. (* states for LVDrawMsg.state *)
  472.   lvrNormal * = 0;              (* the usual                 *)
  473.   lvrSelected * = 1;            (* for selected gadgets      *)
  474.   lvrNormalDisabled * = 2;               (* for disabled gadgets      *)
  475.   lvrSelectedDisabled * = 8;             (* disabled and selected     *)
  476.  
  477. TYPE
  478.  
  479. (* structure of lvDraw messages, object is an Exec.NodePtr *)
  480.   LVDrawMsg * = RECORD (i.MsgBase)
  481.     msg *      : i.Msg;            (* lvDraw                    *)
  482.     rastPort * : gfx.RastPortPtr;  (* where to render to        *)
  483.     drawInfo * : i.DrawInfoPtr;    (* useful to have around     *)
  484.     bounds *   : gfx.Rectangle;    (* limits of where to render *)
  485.     state *    : e.ULONG;          (* how to render             *)
  486.   END;
  487.  
  488.  
  489. (**-- Library Base variable --------------------------------------------*)
  490.  
  491. CONST
  492.  
  493.   gadtoolsName * = "gadtools.library";
  494.  
  495. VAR
  496.  
  497.   base * : e.LibraryPtr;
  498.  
  499.  
  500. (**-- Library Functions ------------------------------------------------*)
  501.  
  502. (*
  503. **      $VER: gadtools_protos.h 39.2 (24.3.92)
  504. *)
  505.  
  506. (* --- functions in V36 or higher (distributed as Release 2.0) ---*)
  507.  
  508. (* Gadget Functions *)
  509.  
  510. PROCEDURE CreateGadgetA* [base,-30]
  511.   ( kind     [0] : e.ULONG;
  512.     gad      [8] : i.GadgetPtr;
  513.     VAR ng   [9] : NewGadget;
  514.     taglist [10] : ARRAY OF u.TagItem )
  515.   : i.GadgetPtr;
  516. PROCEDURE CreateGadget* [base,-30]
  517.   ( kind     [0]   : e.ULONG;
  518.     gad      [8]   : i.GadgetPtr;
  519.     VAR ng   [9]   : NewGadget;
  520.     taglist [10].. : u.Tag )
  521.   : i.GadgetPtr;
  522. PROCEDURE FreeGadgets* [base,-36]
  523.   ( gad [8] : i.GadgetPtr );
  524. PROCEDURE SetGadgetAttrsA* [base,-42]
  525.   ( VAR gad  [8] : i.Gadget;
  526.     win      [9] : i.WindowPtr;
  527.     req     [10] : i.RequesterPtr;
  528.     taglist [11] : ARRAY OF u.TagItem );
  529. PROCEDURE SetGadgetAttrs* [base,-42]
  530.   ( VAR gad  [8]   : i.Gadget;
  531.     win      [9]   : i.WindowPtr;
  532.     req     [10]   : i.RequesterPtr;
  533.     taglist [11].. : u.Tag );
  534.  
  535. (* Menu functions *)
  536.  
  537. PROCEDURE CreateMenusA* [base,-48]
  538.   ( newmenu [8] : ARRAY OF NewMenu;
  539.     taglist [9] : ARRAY OF u.TagItem )
  540.   : i.MenuPtr;
  541. PROCEDURE CreateMenus* [base,-48]
  542.   ( newmenu [8]   : ARRAY OF NewMenu;
  543.     taglist [9].. : u.Tag )
  544.   : i.MenuPtr;
  545. PROCEDURE CreateMenusAB* [base,-48]
  546.   ( newmenu [8] : NewMenuPtr;
  547.     taglist [9] : ARRAY OF u.TagItem )
  548.   : i.MenuPtr;
  549. PROCEDURE CreateMenusB* [base,-48]
  550.   ( newmenu [8]   : NewMenuPtr;
  551.     taglist [9].. : u.Tag )
  552.   : i.MenuPtr;
  553. PROCEDURE FreeMenus* [base,-54]
  554.   ( menu [8] : i.MenuPtr );
  555. PROCEDURE LayoutMenuItemsA* [base,-60]
  556.   ( firstitem [8] : i.MenuItemPtr;
  557.     vi        [9] : VisualInfo;
  558.     taglist  [10] : ARRAY OF u.TagItem )
  559.   : BOOLEAN;
  560. PROCEDURE LayoutMenuItems* [base,-60]
  561.   ( firstitem [8]   : i.MenuItemPtr;
  562.     vi        [9]   : VisualInfo;
  563.     taglist  [10].. : u.Tag )
  564.   : BOOLEAN;
  565. PROCEDURE LayoutMenusA* [base,-66]
  566.   ( firstmenu [8] : i.MenuPtr;
  567.     vi        [9] : VisualInfo;
  568.     taglist  [10] : ARRAY OF u.TagItem )
  569.   : BOOLEAN;
  570. PROCEDURE LayoutMenus* [base,-66]
  571.   ( firstmenu [8]   : i.MenuPtr;
  572.     vi        [9]   : VisualInfo;
  573.     taglist  [10].. : u.Tag )
  574.   : BOOLEAN;
  575.  
  576. (* Misc Event-Handling Functions *)
  577.  
  578. PROCEDURE GetIMsg* [base,-72]
  579.   ( iport [8] : e.MsgPortBasePtr )
  580.   : i.IntuiMessagePtr;
  581. PROCEDURE ReplyIMsg* [base,-78]
  582.   ( imsg [9] : i.IntuiMessageBasePtr );
  583. PROCEDURE RefreshWindow* [base,-84]
  584.   ( win [8] : i.WindowPtr;
  585.     req [9] : i.RequesterPtr );
  586. PROCEDURE BeginRefresh* [base,-90]
  587.   ( win [8] : i.WindowPtr );
  588. PROCEDURE EndRefresh* [base,-96]
  589.   ( win      [8] : i.WindowPtr;
  590.     complete [0] : i.LONGBOOL );
  591. PROCEDURE FilterIMsg* [base,-102]
  592.   ( imsg [9] : i.IntuiMessageBasePtr )
  593.   : i.IntuiMessagePtr;
  594. PROCEDURE PostFilterIMsg* [base,-108]
  595.   ( imsg [8] : i.IntuiMessageBasePtr )
  596.   : i.IntuiMessagePtr;
  597. PROCEDURE CreateContext* [base,-114]
  598.   (  VAR glistptr [8] : i.GadgetPtr )
  599.   : i.GadgetPtr;
  600.  
  601. (* Rendering Functions *)
  602.  
  603. PROCEDURE DrawBevelBoxA* [base,-120]
  604.   ( rport   [8] : gfx.RastPortPtr;
  605.     left    [0] : LONGINT;
  606.     top     [1] : LONGINT;
  607.     width   [2] : LONGINT;
  608.     height  [3] : LONGINT;
  609.     taglist [9] : ARRAY OF u.TagItem );
  610. PROCEDURE DrawBevelBox* [base,-120]
  611.   ( rport   [8]   : gfx.RastPortPtr;
  612.     left    [0]   : LONGINT;
  613.     top     [1]   : LONGINT;
  614.     width   [2]   : LONGINT;
  615.     height  [3]   : LONGINT;
  616.     taglist [9].. : u.Tag );
  617.  
  618. (* Visuals Functions *)
  619.  
  620. PROCEDURE GetVisualInfoA* [base,-126]
  621.   ( screen  [8] : i.ScreenPtr;
  622.     taglist [9] : ARRAY OF u.TagItem )
  623.   : VisualInfo;
  624. PROCEDURE GetVisualInfo* [base,-126]
  625.   ( screen  [8]   : i.ScreenPtr;
  626.     taglist [9].. : u.Tag )
  627.   : VisualInfo;
  628. PROCEDURE FreeVisualInfo* [base,-132]
  629.   ( vi [8] : VisualInfo );
  630.  
  631. (*--- functions in V39 or higher (Release 3) ---*)
  632.  
  633. PROCEDURE GetGadgetAttrsA* [base,-174]
  634.   ( gad      [8] : i.GadgetPtr;
  635.     win      [9] : i.WindowPtr;
  636.     req     [10] : i.RequesterPtr;
  637.     taglist [11] : ARRAY OF u.TagItem )
  638.   : LONGINT;
  639. PROCEDURE GetGadgetAttrs* [base,-174]
  640.   ( gad      [8]  : i.GadgetPtr;
  641.     win      [9]  : i.WindowPtr;
  642.     req     [10]  : i.RequesterPtr;
  643.     taglist [11]..: u.Tag )
  644.   : LONGINT;
  645.  
  646.  
  647. (**-- C Macros defined as procedures -----------------------------------*)
  648.  
  649. <*$LongVars+*>
  650.  
  651. (*  A UserData pointer can be associated with each Menu and MenuItem structure.
  652.     The CreateMenus() call allocates space for a UserData after each
  653.     Menu or MenuItem (header, item or sub-item).  You should use the
  654.     gtMenuUSERDATA() or gtMenuitemUSERDATA() macro to extract it. *)
  655.  
  656. (**-----------------------------------*)
  657. PROCEDURE [0] MenuUserData * (menu : i.MenuPtr) : e.APTR;
  658.  
  659. BEGIN (* MenuUserData *)
  660.   RETURN SYS.VAL (e.APTR, SYS.VAL (LONGINT, menu) + SIZE (i.Menu))
  661. END MenuUserData;
  662.  
  663. (**-----------------------------------*)
  664. PROCEDURE [0] MenuItemUserData * (menuitem : i.MenuItemPtr) : e.APTR;
  665.  
  666. BEGIN (* MenuItemUserData *)
  667.   RETURN
  668.     SYS.VAL (e.APTR, SYS.VAL (LONGINT, menuitem) + SIZE (i.MenuItem))
  669. END MenuItemUserData;
  670.  
  671. (**-- Library Base variable --------------------------------------------*)
  672.  
  673. <*$LongVars-*>
  674.  
  675. (**-----------------------------------*)
  676. PROCEDURE* [0] CloseLib (VAR rc : LONGINT);
  677.  
  678. BEGIN (* CloseLib *)
  679.   IF base # NIL THEN e.CloseLibrary (base) END
  680. END CloseLib;
  681.  
  682. BEGIN
  683.   base := e.OpenLibrary (gadtoolsName, e.libraryMinimum);
  684.   IF base # NIL THEN Kernel.SetCleanup (CloseLib) END
  685. END GadTools.
  686.